var Mock = require('Mockjs');

function getSelectCourseList(req, res) {
  res.send(Mock.mock({
    "code":200,
    "message":null,
    "body":{
      "data|1-10":[
        {
          "descs|1-20":[
            {
              "weekStart|1-25": 1,
              "weekEnd|1-25":1,
              "weekday|1-5": 1,
              "time": '@datetime("H:m")~@datetime("H:m")'
            }
          ],
          "name": '@cword(5,12)',
          "courseId": 1,
          "username": '@cname'
        }
      ],
      "chooseCount|1-4":1,
      "courseId|1-100":1,
      "courseName":'@cword(5,12)'
    },
    "exceptionDescription":null
  }));
}
module.exports.getSelectCourseList = getSelectCourseList;

function getCourseScheduleList(req, res) {
  res.send(Mock.mock({
    "code":200,
    "message":null,
    "body|1-10":[
      {
        "date": '@date',
        "name": '@cword(5,12)',
        "weekday|1-7": 1,
        "courseScheduleId|1-100": 1,
        "time": '@time("HH:mm")',
        "username": '@cname',
        "status|1-3":1
      }
    ],
    "exceptionDescription":null
  }));
}
module.exports.getCourseScheduleList = getCourseScheduleList;

function getCourseScheduleDetail(req, res) {
  res.send(Mock.mock({
    "code":200,
    "message":null,
    "body":{
      "date": '@date',
      // "latitude": 111,
      "latitude":34.193532877,
      "longitude":108.877354931,
      // "longitude": 222,
      "name": '@cword(5,12)',
      "weekday|1-7":1,
      "sign|1-2": false,
      "needSignLocation|1-2": false,
      "signIntevalTime|0-30": 1,
      "time": '@time("HH:mm")',
      "username": '@cname',
      "status|1-3": 3
    },
    "exceptionDescription":null
  }))
}
module.exports.getCourseScheduleDetail = getCourseScheduleDetail;

function getCourseScheduleDescDetail(req, res) {
  res.send(Mock.mock({
    "code":200,
    "message":null,
    "body":{
      "name": '@cword(5,12)',
      "courseId|1-100": 1,
      "username": '@cname',
      "desc": '@cparagraph(50,100)'
    },
    "exceptionDescription":null
  }));
}
module.exports.getCourseScheduleDescDetail = getCourseScheduleDescDetail;


function getMySchoolTarget(req, res) {
  res.send(Mock.mock({
    "body": {
      "morningRunningCountTarget": 10,
      "schoolName": "青动力大学",
      "freeRunningLengthTarget": 30,
      "freeRunningLength": 0,
      "morningTrainingTarget": 0,
      "morningRunningCount": 0,
      "morningTrainingTarget|1-2":false
    },
    "code": 200,
    "message": "操作成功完成",
    "exceptionDescription": null
  }));
}
module.exports.getMySchoolTarget = getMySchoolTarget;

function getMorningTrainRule(req, res) {
  res.send(Mock.mock({
    "code": 200,
    "body":{
      "runningRuleNodeList":[
        {
          "latitude":34.193532877,
          "longitude":108.877354931,
        }
        ,{
          "latitude":34.1911556522,
          "longitude":108.8823253105,
        }
        ,{
          "latitude":34.1908006698,
          "longitude":108.8823521326,
        }
      ],
      "morningTrainRecord":{
        "startDate": '@datetime("yyyy-MM-dd HH:mm:ss")',
        "endDate": '@datetime("yyyy-MM-dd HH:mm:ss")',
        "duration": 123456,
        "durationStr": '@time',
        "isEffective": 88,
        "signLatitude": 123.456,
        "signLongitude": 456.123,
        "latitudeOut": 222.111,
        "longitudeOut": 111.222,
        "currTimeLong": function () {
          var date = new Date();
          var time = date.getTime()/1000;//转换成秒；
          return parseInt(time);
        }
      },
      "runFlag":1,
      "reson":"今日已晨练",
      "runningRule":{
        "runningRuleId": 1016,
        "type": 10,
        "hasRail": 1,
        "speedMin": 0,
        "speedMax": 0,
        "validKiometerMin": 20,
        "validKiometerMax": 60,
        "startTime": '@time("HH:mm")',
        "endTime": '@time("HH:mm")',
        "target": 20,
        "sportCountMax": 1,
        "isDefaultFlag": 1,
        "isUse": 1
      }
    },
    "message": "操作成功完成",
    "exceptionDescription": null
  }));
}
module.exports.getMorningTrainRule = getMorningTrainRule;

function morningtrainSign(req, res) {
  res.send(Mock.mock({
    "code":200,
    "body":{
      "morningTrainRecord":{
        "startDate": '@datetime("yyyy-MM-dd HH:mm:ss")',
        "endDate": null,
        "duration": 0,
        "durationStr":null,
        "isEffective": 0,
        "signLatitude": 34.193532877,
        "signLongitude": 108.877354931,
        "latitudeOut": null,
        "longitudeOut": null,
        "currTimeLong": function () {
          var date = new Date();
          var time = date.getTime()/1000;//转换成秒；
          return parseInt(time);
        }
      }
    },
    "message": "操作成功完成",
    "exceptionDescription": null
  }));
}
module.exports.morningtrainSign = morningtrainSign;

function morningtrainSignOut(req, res) {
  res.send(Mock.mock({
    "code":200,
    "body":{
      "morningTrainRecord":{
        "startDate": '@datetime("yyyy-MM-dd HH:mm:ss")',
        "endDate": '@datetime("yyyy-MM-dd HH:mm:ss")',
        "duration|1-999999": 0,
        "durationStr": '@time',
        "isEffective": 0,
        "signLatitude": 34.193532877,
        "signLongitude": 108.877354931,
        "latitudeOut": 34.1911556522,
        "longitudeOut": 108.8823253105,
        "currTimeLong": function () {
          var date = new Date();
          var time = date.getTime()/1000;//转换成秒；
          return parseInt(time);
        }
      }
    },
    "message": "操作成功完成",
    "exceptionDescription": null
  }));
}
module.exports.morningtrainSignOut = morningtrainSignOut;
